<%@page import="com.webdemo3.bean.UsersBean"%>
<%@page import="com.webdemo3.dao.UsersDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%
	request.setCharacterEncoding("UTF-8");
	String username = request.getParameter("username");
	UsersBean ub = UsersDao.search(username);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户注册</title>
<style>
input{
	border:1px #993 dashed;
}
td{
	padding:15px 5px;
}
</style>
<script type="text/javascript" src="script/Calendar3.js"></script>
<script type="text/javascript" src="script/RegFormCheck.js"></script>
</head>
<body>
<form id="form" name="form" method="post" onsubmit="return RegFormCheck()" action="updateProcess.jsp">
	<input type="hidden" name="upwd" id="upwd" value="<%=ub.getPwd()%>"/>
	<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	      	<td colspan="2" align="center" style="font-size:25px">用户注册</td>
	    </tr>
	    <tr> 	
	      	<td width="200" align="right">用户名：</td>
	      	<td width="400"><input type="text" name="username" id="username" readonly="readonly" value="<%=ub.getUsername()%>"></td>
	    </tr>
	   	<tr>
	      	<td align="right">原始密码：</td>
	      	<td width="400"><input type="password" name="opwd" id="opwd" ></td>
	    </tr>
	    <tr>
	      	<td align="right">密码：</td>
	      	<td width="400"><input type="password" name="pwd" id="pwd" ></td>
	    </tr>
	    <tr>
	      	<td align="right">确认密码：</td>
	      	<td width="400"><input type="password" name="pwd2" id="pwd2"></td>
	    </tr>
	    <tr>
	      	<td align="right">性别：</td>
	      	<%
	      		if(ub.getGender().equals("男")) {
	      		
	      	%>
	      	<td width="400"><input type="radio" id="gender" name="gender" value="男" checked="checked">男<input type="radio" id="gender" name="gender" value="女">女</td>
	      	<%
	      		} else {
	      	%>
	      	<td width="400"><input type="radio" id="gender" name="gender" value="男">男<input type="radio" id="gender" name="gender" checked="checked" value="女">女</td>
	      	<%
	      		}
	      	%>
	    </tr>
	    <tr>
	      	<td align="right">生日</td>
	      	<td width="400"><input type="text" name="birth" id="birth" readonly="readonly" value="<%=ub.getBirth()%>" onClick="new Calendar().show(this);"/></td>
	    </tr>
	    <tr>
	      	<td align="right">手机号码：</td>
	      	<td width="400"><input type="text" name="phone" value="<%=ub.getPhone()%>" id="phone"/></td>
	    </tr>
	    <tr>
		     <td align="right">地址：</td>
		     <td width="400"><input type="text" name="addr" value="<%=ub.getAddr() %>" id="addr" /></td>
	    </tr>
	    <tr>
		     <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="修改">
		     <input type="reset" name="reset" id="reset" value="重置"></td>
	    </tr>
	 </table>
</form>
</body>
</html>
<%
	String errorCode = request.getParameter("errorCode");
	if(errorCode != null && errorCode.equals("5")) {
		out.println("<script>alert('原密码错误');</script>");		
	}
%>
